package com.example.dynamic.controller;

import com.example.dynamic.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;

@RestController
@RequestMapping("test")
public class TestController {

    @Autowired
    private TestService testService;

    @GetMapping("test01")
    public List<String> test01() {
        List<String> list = testService.findAllUser();
        return list;
    }

    @GetMapping("test02")
    public List<String> test02() {
        List<String> list = testService.findAllCompany();
        return list;
    }

    @GetMapping("test03")
    public List<String> test03() {
        List<String> list = testService.findAllCompanyByDs();
        return list;
    }

    @GetMapping("test04")
    public HashMap<String, List<String>> test04() {
        HashMap<String, List<String>> map = new HashMap<>(3);
        List<String> companyList = testService.findAllCompany();
        List<String> userList = testService.findAllUserDs();
        List<String> companyListByDs = testService.findAllCompanyByDs();
        List<String> companyListByDs2 = testService.findAllCompanyByDs2();
        map.put("userList", userList);
        map.put("companyList", companyList);
        map.put("companyListByDs", companyListByDs);
        return map;
    }
}
